

//
//  NSAttributestring + Extension.swift
//  MyWeiBo
//
//  Created by fangzhengwei on 2017/4/9.
//  Copyright © 2017年 fangzhengwei. All rights reserved.
//

import UIKit

extension NSAttributedString {
    
 class func attributeStringAccordingToEmotion(emotion : FZEmotionModel,font : UIFont) -> NSAttributedString {
        
        let image = UIImage(named: emotion.allPath!)
        
        let attachMent = FZAttachMent()
        
        attachMent.image = image
        attachMent.emotionModel = emotion
        let typefaceHeight = font.lineHeight
        
        attachMent.bounds = CGRect(x: 0, y: -4, width: typefaceHeight, height: typefaceHeight)
        
        let attrbuterStr = NSAttributedString(attachment: attachMent)

        return attrbuterStr
    }
}


